package com.zhuangjie.order.feign;

import com.zhaungjie.base.conduit.R;
import com.zhaungjie.base.conduit.TypeR;
import com.zhuangjie.coupon.dto.QueryConfirmRequireDTO;
import com.zhuangjie.order.vo.ShopInfoForOrder;
import com.zhuangjie.shop.dto.ShopEvaluateDTO;
import com.zhuangjie.shop.vo.*;
import com.zhuangjie.shop.vo.order_confirm_require.OrderConfirmRequireVO;
import com.zhuangjie.shop.vo.predetermine.GeneratedPredetermineDayAndTimesInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

@Component
@FeignClient(name = "spark-shop",path = "/shop")
public interface ShopFeignService {

    /**
     * 获取店铺预定信息-内部模块使用版
     *
     * @param shopId          店铺id
     * @param receivingMethod 接收方法
     * @param addressBookId   通讯簿id 如果是配送这是必须的
     * @return {@link TypeR}<{@link GeneratedPredetermineDayAndTimesInfo}>
     */
    @GetMapping("/shop/shop-predetermine/days-timeRanges/internal-use")
    TypeR<PredetermineDayAndTimeRangesForInternalUse> shopBusinessDaysTimeRangesForInternalUse(@RequestParam("shopId") Long shopId, @RequestParam("receivingMethod") String receivingMethod, @RequestParam("addressBookId") Long addressBookId);

    /**
     * 获取商店下一个自提叫号
     *
     * @param shopId 店铺id
     * @return {@link TypeR}<{@link Integer}>
     */
    @GetMapping("/shop-self-pickup-serial-number/next")
    TypeR<Integer> nextShopSelfPickupSerialNumber(@RequestParam("shopId") Long shopId);

    /**
     * 获取创建订单商店基本信息
     *
     * @param shopId 店铺id
     * @return {@link TypeR}<{@link CreateOrderShopBasicInfo}>
     */
    @GetMapping("/shop/create-order-basic-info")
    TypeR<CreateOrderShopBasicInfo> getCreateOrderShopBasicInfo(@RequestParam("shopId") Long shopId);


    /**
     * 列出用户购物车
     *
     * @param shopId 店铺id
     * @return {@link TypeR}<{@link List}<{@link CartItemVO}>>
     */
    @GetMapping("/cart/list/{shopId}")
    TypeR<List<CartItemVO>> listUserShoppingCart(@PathVariable("shopId") Long shopId);


    /**
     * 获取店铺的联系电话
     *
     * @param shopId 店铺id
     * @return {@link TypeR}<{@link String}>
     */
    @GetMapping("/shop/phone")
    TypeR<String> getShopPhone(@RequestParam("shopId") Long shopId);


    /**
     * 为订单获取其shop信息（根据订单id批量获取）
     *
     * @param shopIds 格式："商店id1,商店id2,..."
     * @return {@link R}
     */
    @GetMapping("/shop/list-shop-info-for-order")
    TypeR<List<ShopInfoForOrder>> getShopInfoListForOrder(@RequestParam("shopIds") String shopIds);

    /**
     *  获取骑手到达店铺shop信息（配送信息）
     * @param shopId 店铺id
     * @return TypeR<ShopForRider>
     */
    @GetMapping("/address")
    TypeR<ShopForRider> getShopAddress(@RequestParam("shopId") Long shopId);

    /**
     * 查询订单确认需要的数据
     * @param queryConfirmRequireDTO 查询 `订单确认需要的数据` dto
     * @return TypeR<OrderConfirmRequireVO>
     */
    @PostMapping("/cart/order-confirm-require")
    TypeR<OrderConfirmRequireVO> queryOrderConfirmRequire(@Valid @RequestBody QueryConfirmRequireDTO queryConfirmRequireDTO);

    /**
     * 查询店铺的使用配送方式
     * @param shopId 店铺id
     * @return TypeR<Short>
     */
    @GetMapping("/shop/delivery-method/{shopId}")
    TypeR<Short> queryShopDeliveryMethod(@PathVariable("shopId") Long shopId);

    /**
     * 创建店铺订单入账记录
     * @param orderId
     * @return TypeR<Void>
     */
    @PostMapping("/shop-order-accounting-record/order-accounting/{orderId}")
    TypeR<Void> createOrderAccounting(@PathVariable("orderId") Long orderId);


    /**
     * 获取店铺信息-用于用户查看外卖信息的地图展示
     * @param shopId 店铺id
     * @return TypeR<ShopForUserOrderMapVO>
     */
    @GetMapping("/shop/select-shop-info-for-user-order-map/{shopId}")
    TypeR<ShopForUserOrderMapVO> selectShopInfoForUserOrderMap(@PathVariable("shopId") Long shopId);


    /**
     * 子评价-评价提交到商家
     * @param shopEvaluateDTO 店铺评价
     * @return TypeR<Void>
     */
    @PostMapping("/shop-evaluate/submit")
    TypeR<Void> submitShopEvaluate(@RequestBody ShopEvaluateDTO shopEvaluateDTO);

    /**
     * 清空购物车
     * @param shopId 店铺id
     * @return TypeR<Void>
     */
    @PostMapping("/cart/clear/{shopId}")
    TypeR<Void> clearShoppingCart(@NotNull(message = "店铺id不能为空") @PathVariable("shopId") Long shopId);

}
